package com.my.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @author 林允
 * @version 1.0
 * @description: TODO
 * @date 2023/11/24 14:07
 */

/**
 * 此类为连接工厂创建信道的工具类
 */
public class RabbitMQUtils {

    // 得到一个连接的channel
    public static Channel getChannel() throws Exception{
        // 创建一个连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.203.131");
        factory.setUsername("admin");
        factory.setPassword("123");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();
        return channel;
    }

}
